package com.iflytek.day10;

public class _08_UserDemo {
  public static void main(String[] args) {
    // 利用空参构造创建对象
    _08_User u1 = new _08_User();
    // 如果利用空参创建对象，还想赋值只能用set方法赋值
    u1.setUsername("zhangsan");
    u1.setPassword("1234qwer");
    u1.setEmail("zhangsan@sina.cn");
    u1.setGender('男');
    u1.setAge(23);
    // 获取属性的值并打印
    System.out.println(u1.getUsername() + ", " + u1.getPassword()
            + ", " + u1.getEmail() + ", " + u1.getGender() + ", " + u1.getAge());
    u1.eat();

    System.out.println("=============================");

    // 简单的办法
    // 利用带全部参数的构造来创建对象
    _08_User u2 = new _08_User("lisi", "12345678", "lisi@sina.cn", '女', 24);
    System.out.println(u2.getUsername() + ", " + u2.getPassword()
            + ", " + u2.getEmail() + ", " + u2.getGender() + ", " + u2.getAge());
    u2.eat();
  }
}